package com.ibiaoke.marketing.utils;

import com.ibiaoke.common.consts.CommonConsts;
import com.ibiaoke.common.utils.AssertUtils;
import com.ibiaoke.marketing.entity.Marketing;

import java.util.Date;

public class MarketingUtils {
    public static void validate(Marketing marketing) {
        AssertUtils.notNull(marketing,"活动不存在");
        AssertUtils.requireEquals(marketing.getDelStatus(), CommonConsts.NO,"活动已被删除");
        AssertUtils.requireTrue(marketing.getBeginTime().before(new Date()),"活动未开始");
        AssertUtils.requireTrue(marketing.getEndTime().after(new Date()),"活动未已结束");
    }
}
